home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
tcb100t.arc
/
MANUAL.DOC
< prev
next >
Wrap
Text File
|
1988-03-05
|
40KB
|
1,298 lines
.mt 8
.he
.op
C Tool Box
A Library of Functions for
Turbo C 1.00
Containing Graphics, Fonts,
Windows, Sound, Background Sound
Mouse, Joystick and Printer Controls
and more
Version 1.00
release date 22 August 1987
Copyright (c) 1987
by
David A. Miller
Unicorn Software
8018 NE 123rd St.
Kirkland, WA 98034
(206) 823-4656 after 6:30 PM
Pacific Time Zone
(No collect calls Please)
è
Welcomσá t∩ thσ realφ oµ thσ mystica∞ Unicorn«á I⌠ ha≤á beeεá aε ì
enjoyablσá proces≤ creatinτ thi≤ librar∙ anΣ thσ autho≥ hope≤ yo⌡ ì
find it equally enjoyable to use.
Disclaimer
Thσ autho≥ ha≤ takeε duσ carσ iε thσ preparatioε oµ thi≤ manua∞ ì
anΣ thσ associateΣ program≤ t∩ insurσ tha⌠ al∞ informatioε ì
presenteΣ i≤ correc⌠ anΣ functiona∞ a≤ stated« N∩ warrant∙ i≤ ì
madσ regardinτ thσ suitabilit∙ oµ thi≤ produc⌠ fo≥ an∙ specifiπ ì
purpose. Consisten⌠ witΦ thσ requiremen⌠ oµ speeΣ iε mucΦ oµ ì
thσ librar∙ anΣ thσ genera∞ philosoph∙ oµ ├ iε allowinτ thσ ì
programme≥ completσ freedom¼ thσ amoun⌠ oµ erro≥ checkinτ ha≤ ì
beeε helΣ t∩ ß minimum.
Thσ autho≥ hereb∙ grant≤ permissioε t∩ al∞ user≤ t∩ transfe≥ ì
copie≤ oµ thσ librar∙ t∩ thirΣ partie≤ subjec⌠ t∩ thσ condition≤ ì
tha⌠ thσ entirσ librar∙ anΣ al∞ file≤ includinτ copyright≤ bσ ì
transferreΣ iε ful∞ fo≥ n∩ feσ execep⌠ iε thσ casσ oµ user≤ group≤ ì
whicΦ ma∙ chargσ ß copyinτ feσ no⌠ t∩ exceeΣ $7.00.
Whilσ yo⌡ ma∙ usσ thσ librar∙ fo≥ persona∞ program≤ withou⌠ ì
registration¼ thosσ wh∩ creatσ program≤ fo≥ salσ o≥ distributioε ì
arσ requesteΣ t∩ registe≥ thei≥ copy« Thσ sourcσ codσ ma∙ NO╘ bσ ì
distributeΣ t∩ ß thirΣ part∙ iε an∙ forφ withou⌠ thσ writteε ì
permissioε oµ thσ author.
Turb∩ ├ i≤ ß trademarδ oµ BorlanΣ International¼ Microsof⌠ C¼ ì
MAS═ anΣ MSDO╙ arσ trademark≤ oµ Microsof⌠ Corp« IBM¼ IB═ PC¼ ì
P├ XT¼ AT¼ DO╙ anΣ PCDO╙ arσ trademark≤ oµ Internationa∞ Busines≤ ì
Machine≤ Corp.¼ Epsoε i≤ ß trademarδ oµ Epsoε Corp« Tandy¼ Tand∙ ì
1000 A and DMP 130 are trademarks of Tandy Corp.ì
.paè.he C_Tool_Box_______________________________________________Page_#
Background
Thi≤ librar∙ i≤ thσ successo≥ t∩ thσ origina∞ Unicorε Librar∙ ì
whicΦ ha≤ undergonσ severa∞ revision≤ anΣ essentiall∙ ha≤ becomσ ì
ß ne≈ entity« Somσ oµ thσ curren⌠ revision≤ concerε simplσ ì
orderinτ oµ thσ parameter≤ iε call≤ t∩ makσ thσ librar∙ morσ ì
consistent« User≤ oµ thσ Unicorε librar∙ shoulΣ takσ particula≥ ì
notσ oµ thi≤ point« Function≤ havσ beeε developeΣ fo≥ whicΦ thσ ì
autho≥ ha≤ n∩ specifiπ neeΣ bu⌠ founΣ interestinτ t∩ implement« ì
Man∙ oµ thσ function≤ arσ ß resul⌠ oµ use≥ suggestion≤ fo≥ whicΦ ì
wσ thanδ thσ user≤ involved« Thσ autho≥ invite≤ user≤ t∩ makσ ì
furthe≥ suggestions¼ a≤ ß worthwilσ challengσ i≤ alway≤ aε ì
interestinτ learninτ experience.
Thi≤ librar∙ contain≤ function≤ t∩ perforφ ß widσ variet∙ oµ ì
task≤ Thσ function≤ ma∙ bσ divideΣ roughl∙ int∩ thσ followinτ ì
categories:
1« Genera∞ vide∩ includinτ window≤ anΣ fas⌠ strinτ writes.
2« Graphics¼ includinτ ß variet∙ oµ norma∞ anΣ rotateΣ fonts
3« SounΣ includinτ backgrounΣ sounΣ function≤ simila≥ t∩ BASIC
4« Genera∞ function≤ servinτ ß widσ variet∙ oµ purposes
5« Printe≥ control¼ botΦ graphic≤ anΣ dais∙ wheel
6« Mousσ control
7« Joysticδ control
EacΦ oµ thesσ grouping≤ overlap≤ t∩ somσ exten⌠ bu⌠ iε genera∞ ì
all¼ excep⌠ thσ graphic≤ iε grou≡ 2¼ ma∙ bσ useΣ witΦ ß ì
monochromσ system« Thσ genera∞ librar∙ i≤ designeΣ t∩ bσ useΣ ì
witΦ Turb∩ ├ froφ BorlanΣ anΣ program≤ writteε usinτ thσ smal∞ ì
memor∙ model« Othe≥ compiler≤ arσ supporteΣ anΣ librarie≤ ma∙ bσ ì
requesteΣ froφ thσ autho≥ upoε registration« Iε additioε t∩ thi≤ ì
basiπ library¼ thosσ availablσ includσ thσ largσ mode∞ fo≥ Turb∩ ì
├ anΣ botΦ model≤ fo≥ Microsof⌠ ├ ¿ Curren⌠ versioε )« Thσ ì
autho≥ wil∞ als∩ makσ ß Latticσ ├ versioε 3.░ librar∙ availablσ ì
iµ therσ arσ enougΦ requests« Whilσ thesσ arσ thσ basiπ ì
compiler≤ thσ autho≥ ha≤ acces≤ to¼ other≤ ma∙ bσ supporteΣ iµ ì
thσ numbe≥ oµ request≤ warrant.
Thσ entirσ manua∞ i≤ no⌠ supplieΣ witΦ thσ Bulletiε BoarΣ ì
versioε oµ thσ librar∙ duσ t∩ space« EnougΦ oµ thσ manua∞ i≤ ì
includeΣ t∩ makσ thσ librar∙ usablσ includinτ ß brieµ descriptioε ì
oµ eacΦ functioε anΣ ß cal∞ iε ß forφ simila≥ t∩ functioε ì
prototyping« Thσ entirσ manua∞ i≤ availablσ oε disδ iε Wordsta≥ ì
o≥ ASCI╔ tex⌠ forma⌠ anΣ wil∞ bσ sen⌠ t∩ al∞ registereΣ owner≤ ì
(pleasσ specif∙ whicΦ format)« PreprinteΣ manual≤ arσ availablσ ì
fo≥ thosσ wh∩ don'⌠ wisΦ t∩ prin⌠ ove≥ 20░ pages« Seσ thσ ì
registratioε forφ fo≥ details«
.paè First Things First
Iµ yo⌡ havσ registereΣ you≥ librar∙ anΣ havσ thσ ful∞ sourcσ ì
distributioε disks¼ yo⌡ shoulΣ havσ onσ disδ oµ ├ sourcσ codσ anΣ ì
headers¼ onσ oµ AS═ sourcσ codσ anΣ eithe≥ ß disδ containinτ thσ ì
manua∞ o≥ thσ preprinteΣ manua∞.
Checδ you≥ disk≤ t∩ insurσ tha⌠ al∞ file≤ arσ readable« Therσ ì
shoulΣ bσ 1┤ ├ sourcσ files¼ 1┤ AS═ sourcσ file≤ anΣ │ heade≥ ì
file≤ a≤ oµ thi≤ writing« Thi≤ amount≤ t∩ ove≥ 500╦ oµ sourcσ ì
code«
Therσ i≤ n∩ particula≥ installatioε proces≤ fo≥ thi≤ library« I⌠ ì
i≤ read∙ t∩ usσ a≤ is« Simpl∙ placσ thσ librar∙ iε thσ director∙ ì
with the other libraries you use with your compiler.
Man∙ oµ thσ critica∞ function≤ havσ beeε codeΣ iε assemble≥ fo≥ ì
speed« Somσ oµ thσ presen⌠ function≤ codeΣ iε ├ (thσ font≤ ì
remaininτ iε ├ anΣ rotateΣ font≤ iε particular⌐ wil∞ bσ codeΣ iε ì
assemble≥ iε futurσ revisions« Therσ arσ ß fe≈ instance≤ wherσ ì
function≤ perforφ simila≥ task≤ bu⌠ arσ codeΣ differently« Fo≥ ì
example¼ therσ i≤ botΦ aε assemble≥ anΣ ß ├ functioε t∩ se⌠ thσ ì
vide∩ mode« Somσ oµ thesσ havσ beeε lef⌠ a≤ learninτ tool≤ fo≥ ì
thσ use≥ a≤ the∙ illustratσ botΦ approache≤ t∩ solutioε oµ ß ì
particula≥ task« Sincσ thi≤ librar∙ wa≤ beguε a≤ ß learninτ ì
project¼ i⌠ i≤ fel⌠ thσ use≥ ma∙ benefi⌠ froφ sucΦ material«
Makσ ß backu≡ cop∙ beforσ yo⌡ d∩ anythinτ else« Thσ disk≤ arσ ì
no⌠ copy-protectedé iε an∙ manner« Also¼ i⌠ woulΣ bσ helpfu∞ iµ ì
yo⌡ reaΣ thσ filσ READ.M┼ a≤ i⌠ contain≤ thσ lates⌠ informatioε ì
concerninτ thσ library« Wherσ thi≤ manua∞ anΣ READ.M┼ conflict¼ ì
pleasσ regarΣ thσ READ.M┼ filσ a≤ beinτ thσ mos⌠ curren⌠ ì
information«
Therσ arσ dem∩ program≤ oε thσ disk¼ thσ larges⌠ beinτ CTDEMO.EX┼ ì
anΣ CTDEMO.C« Thi≤ wa≤ compileΣ witΦ thσ librar∙ oε thσ ì
distributioε disk≤ anΣ illustrate≤ thσ capabilit∙ oµ thσ librar∙ ì
itselµ althougΦ i⌠ b∙ n∩ mean≤ use≤ o≥ illustrate≤ ever∙ functioε ì
iε thσ library.
Thσ library¼ a≤ delivereΣ normally¼ i≤ thσ smal∞ memor∙ mode∞ oµ ì
Turb∩ C¼ anΣ al∞ references¼ unles≤ otherwisσ stated¼ wil∞ refe≥ ì
t∩ tha⌠ configuration.
Therσ arσ ove≥ 20░ functionsé containeΣ withiε thσ ├ Too∞ Bo° anΣ ì
therσ i≤ ß shor⌠ referencσ sectioε givinτ ß brieµ samplσ cal∞ anΣ ì
descriptioε oµ eacΦ functioε late≥ iε thσ manual« Thσ ì
comprehensivσ sectioε followinτ tha⌠ give≤ ß completσ call¼ ì
paramete≥ description¼ samplσ prograφ o≥ codσ fragmen⌠ ìèillustratinτ thσ fuction≤ usage¼ return≤ anΣ an∙ caveat≤ tha⌠ ma∙ ì
occu≥ witΦ tha⌠ function.
Al∞ oµ thσ function≤ wil∞ perforφ correctl∙ witΦ IB═ PC'≤ o≥ ì
closσ compatibles¼ bu⌠ bσ awarσ tha⌠ fo≥ severa∞ oµ thσ critica∞ ì
timinτ function≤ direc⌠ screeε writinτ i≤ useΣ t∩ improvσ ì
performance« Unles≤ you≥ machinσ addresse≤ vide∩ memor∙ iε thσ ì
samσ manne≥ a≤ thσ IBM¼ ß probleφ ma∙ exist« Thσ librar∙ wa≤ ì
writteε oε ß Tand∙ 100░ ┴ anΣ ha≤ beeε ruε oε severa∞ othe≥ ì
machine≤ witΦ completσ success.
Al∞ function≤ beginninτ witΦ d° arσ designeΣ t∩ suppor⌠ ß dais∙ ì
whee∞ printer« The∙ werσ developeΣ oε ß Epsoε printe≥ tha⌠ i≤ ì
compatiblσ witΦ thσ DW-630« Al∞ function≤ begininτ witΦ g≥ arσ ì
designeΣ t∩ suppor⌠ thσ IB═ graphic≤ printe≥ o≥ compatible« ì
Thesσ werσ developeΣ oε ß TAND┘ DM╨ 130«
Thosσ wh∩ arσ registereΣ owner≤ anΣ havσ thσ sourcσ codσ wil∞ ì
finΣ tha⌠ onl∙ fou≥ function≤ neeΣ t∩ bσ altereΣ t∩ suppor⌠ othe≥ ì
graphic≤ systems« Thesσ arσ thσ tw∩ do⌠ routine≤ (interna∞ anΣ ì
external⌐ anΣ thσ tw∩ function≤ t∩ returε thσ colo≥ oµ ß pixe∞ ì
(interna∞ anΣ external)« Al∞ othe≥ function≤ arσ baseΣ oε thesσ ì
t∩ makσ conversioε easier« Thσ autho≥ doe≤ no⌠ havσ acces≤ t∩ ß ì
Hercule≤ systeφ fo≥ thi≤ conversion« ┴ conversioε t∩ thσ EG┴ i≤ ì
currentl∙ underwa∙ althougΦ acces≤ t∩ aε EG┴ systeφ i≤ ver∙ ì
limiteΣ fo≥ testinτ purposes.
Update Policy
I⌠ i≤ thσ polic∙ oµ Unicorε Softwarσ t∩ providσ onσ freσ updatσ ì
fo≥ thσ librar∙ itselµ (no⌠ thσ sourcσ codσ whicΦ ma∙ bσ updateΣ ì
fo≥ ß smal∞ fee⌐ anΣ notificatioε oµ onσ updatσ beyonΣ that« Iµ ì
thσ ne≈ librar∙ i≤ registereΣ fo≥ thσ updatσ fee¼ theε wσ wil∞ ì
star⌠ thσ proces≤ ove≥ agaiε anΣ yo⌡ wil∞ agaiε receivσ onσ freσ ì
updatσ anΣ onσ notificatioε beyonΣ tha⌠ point« Thi≤ insure≤ ì
user≤ wh∩ registe≥ wil∞ alway≤ havσ acces≤ t∩ thσ lates⌠ versioε ì
oµ thσ Too∞ Box« Mino≥ release≤ wil∞ bσ placeΣ oε bulletiε ì
board≤, bu⌠ registereΣ user≤ wil∞ no⌠ bσ notifieΣ directl∙ unles≤ ì
the∙ s∩ request« (I⌠ i≤ fel⌠ tha⌠ mos⌠ woulΣ prefe≥ t∩ usσ thσ ì
freσ updatσ fo≥ ß majo≥ release)« Currentl∙ thσ autho≥ place≤ ì
copie≤ oµ thσ Too∞ Bo° (majo≥ anΣ mino≥ releases⌐ directl∙ oε thσ ì
followinτ board≤ iε thσ Seattlσ area.
1. Journey to Mars (RBBS) 206 486-3136
2. Night Shift (RBBS) 206 488-0924
3. Planet Claire (RBBS) 206 783-8037
4. PNW IBM user group (RBBS) 206 343-7843
è
Thσ autho≥ log≤ oε witΦ thσ namσ 'Davσ Millerº oε eacΦ oµ thesσ ì
boards.
Thσ mos⌠ likel∙ spo⌠ t∩ finΣ thσ autho≥ fo≥ feedbacδ woulΣ bσ ì
Journey to Mars or Nightshift.
Programming Style
Thσ sourcσ codσ i≤ writteε iε standarΣ ╦ ª ╥ witΦ onσ deviation« ì
Thσ autho≥ prefer≤ thσ openinτ anΣ closinτ brace≤ t∩ linσ u≡ s∩ ì
insteaΣ of:
if (i = 2) {
printf("I = 2");
}
you will find:
if (i = 2)
{
printf("I = 2");
}
in the source code for the Tool Box.
Declaration of Functions
Mos⌠ function≤ arσ eithe≥ voiΣ o≥ returε int« I⌠ i≤ no⌠ strictl∙ ì
requireΣ t∩ declarσ theφ prio≥ t∩ use« I⌠ i≤ GOO─ PROGRAMMIN╟ ì
PRACTICEé t∩ declarσ al∞ function≤ prio≥ t∩ use« Thi≤ practicσ ì
wil∞ avoiΣ problem≤ witΦ thσ fe≈ function≤ whicΦ d∩ returε ß ì
differen⌠ value¼ sucΦ a≤ ß pointe≥ t∩ ß window«
.paè Technical
Thi≤ librar∙ wa≤ createΣ usinτ thσ followinτ tools.
Turb∩ ├ 1.00
Microsof⌠ Linδ 3.51
MAS═ 4.0
Microsof⌠ Librar∙ Manage≥ 3.02
Thσ module≤ useΣ anΣ thσ orde≥ the∙ shoulΣ appea≥ iε thσ librar∙ ì
ma∙ bσ founΣ b∙ usinτ LI┬ t∩ creatσ aε LS╘ filσ oµ thσ library« ì
Iµ yo⌡ registe≥ anΣ wisΦ t∩ recompilσ fo≥ ß differen⌠ memor∙ ì
mode∞ o≥ compile≥, thi≤ orde≥ shoulΣ bσ preserved.
A⌠ presen⌠, ß smal∞ buτ exist≤ iε thσ endsounΣ function« I⌠ wil∞ ì
bσ bes⌠ iµ yo⌡ le⌠ backgrounΣ sounΣ ruε it≤ course¼ anΣ no⌠ ì
attemp⌠ t∩ sto≡ i⌠ witΦ thi≤ command« Thi≤ wil∞ bσ fixeΣ iε thσ ì
nex⌠ majo≥ releasσ ¿ Jaε 198╕ )« RegistereΣ owner≤ wil∞ ì
automaticall∙ receivσ thσ ne≈ sourcσ fo≥ thi≤ functioε witΦ thei≥ ì
freσ updatσ disk.
Revision≤ arσ possiblσ iε somσ function≤ iε thσ nex⌠ release« ì
Ever∙ possiblσ effor⌠ wil∞ bσ useΣ t∩ maintaiε FUL╠ ì
compatibility¼ bu⌠ bσ awarσ tha⌠ thσ call≤ t∩ somσ windo≈ ì
function≤ anΣ t∩ thσ backgrounΣ sounΣ function≤ ma∙ bσ altereΣ ì
somewhat« Wheε usinτ thσ Too∞ Bo° pleasσ kee≡ thi≤ iε minΣ iµ ì
yo⌡ plaε t∩ upgrade« I⌠ i≤ anticipateΣ thσ change≤ wil∞ no⌠ bσ ì
extensivσ anΣ additiona∞ function≤ wil∞ bσ addeΣ whereve≥ ì
possiblσ rathe≥ thaε alterinτ thσ existinτ functions« Thσ autho≥ ì
wil∞ preservσ al∞ curren⌠ functioε call≤ intac⌠ iε al∞ release≤ ì
beyonΣ thi≤ point.
.paè Your First Program
Usinτ thσ ├ Too∞ Boxé i≤ essentiall∙ quitσ simple« WitΦ Turb∩ ├ ì
yo⌡ mus⌠ specif∙ an∙ module≤ t∩ bσ linkeΣ iε you≥ projec⌠ file« ì
Iµ the∙ arσ no⌠ ├ file≤ theε thσ completσ extensioε mus⌠ bσ used« ì
Fo≥ examplσ supposσ yo⌡ wisΦ t∩ builΣ ß filσ 'mytest.exeº froφ ì
mytest.π anΣ thσ ├ Too∞ Boxé library« You≥ projec⌠ filσ shoulΣ bσ ì
iε ß forφ simila≥ t∩ thσ below:
mytest
CTB100.LIB
Wheε yo⌡ arσ withiε thσ Turb∩ ├ environmen⌠, simply usσ Al⌠ ╨ t∩ ì
indicatσ thσ projec⌠ filσ namσ anΣ theε Al⌠ ╥ t∩ builΣ anΣ ruε ì
you≥ program« Yo⌡ ma∙ als∩ builΣ you≥ prograφ froφ thσ commanΣ ì
linσ b∙ typing:
TC├ mytes⌠ CTB100.lib
Eithe≥ approacΦ wil∞ builΣ you≥ prograφ anΣ linδ i⌠ witΦ thσ ├ ì
Too∞ Boxé librar∙.
Thσ dem∩ prograφ wa≤ buil⌠ usinτ thσ command:
TC├ CTDEM╧ CTB100.LIB
Therσ i≤ ß projec⌠ filσ oε thσ disδ iµ yo⌡ prefe≥ t∩ worδ withiε ì
thσ Turb∩ ├ environment« Thσ dem∩ ma∙ bσ buil⌠ b∙ specifyinτ ì
ctdem∩ a≤ thσ filσ anΣ ctdemo.prΩ a≤ thσ projec⌠ file« Usσ AL╘ ≥ ì
t∩ ruε thσ prograφ o≥ AL╘ π t∩ compilσ it.
.paè The Future
Thσ nex⌠ majo≥ releasσ i≤ planneΣ fo≥ Jaε., 1988« Somσ ì
of the ideas being considered and/or worked on are:
1. Animation functions
2. Data entry functions
3. Menu functions (including pulldown)
4. Additional window functions
5« Additiona∞ sounΣ functions
6« Font≤ - rewrittinτ thosσ lef⌠ codeΣ iε ├ iε assemble≥ ì
fo≥ speeΣ anΣ ß truσ strokσ fon⌠ capability« Thi≤ wa≤ ì
containeΣ iε thσ origina∞ Latticσ ├ version╗ Thσ autho≥
woulΣ likσ t∩ restorσ i⌠ witΦ ful∞ rotation¼
translatioε anΣ scalinτ fo≥ thσ nex⌠ majo≥ release.
Thσ autho≥ wishe≤ t∩ continuσ providinτ thi≤ librar∙ t∩ user≤ iε ì
thσ forφ oµ sharewarσ consisten⌠ witΦ use≥ support« I⌠ ha≤ beeε ì
aε enjoyablσ sparσ timσ projec⌠ ove≥ thσ las⌠ yea≥ anΣ ß half« ì
Thσ autho≥ feel≤ sharewarσ i≤ aε importan⌠ elemen⌠ iε today'≤ ì
compute≥ environment.
Pleasσ fee∞ freσ t∩ expres≤ you≥ opinioε oε wha⌠ yo⌡ wisΦ t∩ seσ ì
madσ available« Le⌠ u≤ know!
.paè Interna∞ Globa∞ Variables
The librar∙ contains a serie≤ oµ globa∞ variables« Yo⌡ ì
shoulΣ no⌠ usσ thesσ name≤ iε you≥ program≤ unles≤ yo⌡ ì
specificall∙ wisΦ t∩ referencσ tha⌠ variable« Fo≥ examplσ usinτ ì
ß variablσ nameΣ bdr▒ iε you≥ prograφ wil∞ resul⌠ iε ß linδ erro≥ ì
a⌠ bes⌠ o≥ failurσ oµ thσ windowinτ function≤ tha⌠ usσ borde≥ ▒ ì
a⌠ worst« Belo≈ i≤ ß lis⌠ oµ thesσ variable≤ anΣ thei≥ interna∞ ì
meaning≤ t∩ thσ library.
int BLACK the color black
int BLUE the color blue
int GREEN the color green
int CYAN the color cyan
int RED the color red
int MAGENTA the color magenta
int BROWN the color brown
int GRAY the color gray
int GREY the color gray
int WHITE the color gray
int DARK_GRAY the color dark gray
int DARK_GREY the color dark gray
int LTBLUE the color light blue
int LTGREEN the color light green
int LTCYAN the color light cyan
int LTRED the color light red
int LTMAGENTA the colorlight magenta
int LTBROWN the color yellow
int YELLOW the color yellow
int LTWHITE the color light or bright white
int NORMAL the normal monochrome attribute
int UNDERLINE the underline monochrome attribute
int REVERSE the reverse video monochrome attribute
int BRIGHT the highlighted monochrome attribute
int BLINK monochrome blink bit indicator
int v_start starting address for video memory
int ct_mode_ current video mode
int ct_col_ current number of video columns
in⌠ ct_color▀ indicate≤ iµ colo≥ i≤ alloweΣ (1⌐ o≥ no⌠ ì
BORDER bdr1 a single line border for windows
BORDE╥ bdr1▓ ß borde≥ witΦ ß singlσ vertica∞ linσ anΣ
double horizontal lines.
BORDE╥ bdr2▒ ß borde≥ witΦ doublσ vertica∞ line≤ anΣ
a single horizontal line
BORDER star a border of "*" characters
BORDER dot a border of "." charactersèBORDER solid a border of solid blocks ( char 219)
BORDER heart a border of heart characters
BORDER space a blank border of space characters
NOTE - The default border is a double
line.
BORDE╥ i≤ ß pointe≥ t∩ ß borde≥.
WINDOW is a pointer to a box,
generall∙ indicateΣ b∙ 'bpº iε
documentation.
Seσ thσ heade≥ CTB.╚ fo≥ additiona∞ variable≤ anΣ define≤ tha⌠ ì
ma∙ bσ useful.
.paè Registration Form
Thi≤ librar∙ i≤ distributeΣ a≤ sharewarσ whicΦ simpl∙ mean≤ ì
yo⌡ arσ freσ t∩ copy¼ usσ anΣ pas≤ copie≤ oε t∩ friend≤ fo≥ ì
evaluation« Iµ yo⌡ decidσ i⌠ i≤ useful¼ yo⌡ ma∙ registe≥ you≥ ì
cop∙ witΦ thσ author« Upoε registratioε yo⌡ wil∞ receivσ thσ ì
completσ sourcσ codσ fo≥ thσ librar∙ anΣ ß cop∙ oµ thσ manua∞ oε ì
disk« Thi≤ wil∞ consis⌠ oµ │ disks« Iε additioε yo⌡ wil∞ ì
receivσ thσ firs⌠ updatσ disδ freeé anΣ notificatioε oµ an∙ ì
furthe≥ updates« Majo≥ releasσ update≤ arσ occurinτ abou⌠ │ ì
time≤ ß year.
Thσ curren⌠ registratioε feσ i≤ $29.95é
Name: ______________________________________________
Computer Type: ______________________________________________
Address: ______________________________________________
______________________________________________
City/State/Zip: _________________________ ____ _____________
Library Version: _CTB_1.00___________________________________
Compiler: (check 1)
Turbo C ___ Microsoft C ___ other __________
Morσ thaε onσ versioε ma∙ bσ requested« Pleasσ adΣ aε updatσ fee
oµ $12.95 fo≥ eacΦ additiona∞ version.
PreprinteΣ manua∞ page≤ suitablσ fo≥ placemen⌠ iε ß threσ rinτ ì
binde≥ wil∞ bσ supplieΣ fo≥ aε additiona∞ $18.00.
User Statement
╔ realizσ tha⌠ whilσ thσ librar∙ ma∙ bσ freel∙ giveε awa∙ t∩ ì
thirΣ partie≤ thσ sourcσ codσ i≤ no⌠ publiπ domaiε anΣ ╔ agreσ t∩ ì
protect the authors code and not to pass it on to third parties.
Signed: ___________________________ Date: ________________
Comment≤ o≥ additiona∞ informatioε ma∙ bσ placeΣ oε thσ bacδ oµ ì
this page.
.paè Functioε Descriptions
atsay (row, col, fore, back, *string);
Print a string in color at row, column
bacδ i≤ fo≥ graphics. It'≤ ß dumm∙ paramte≥ iε tex⌠
mode.
bac16_4 (fore, back)
Set≤á4░ columε tex⌠ modσ t∩ usσ highlighteΣ backgrounΣ ì
colors
back16_8 (fore, back)
Set≤ 8░ columε tex⌠ modσ t∩ usσ highlighteΣá backgrounΣ ì
colors
backclr (color)
Set the background color
backsnd ()
Background sound function
beepsp ()
Beeps the speaker with a tone similar to the DOS beep
blink16_4 (fore, back)
Sets 40 column text mode to normal blink attribute
blink16_8 (fore, back)
Sets 80 column text mode to normal blink attribute
boxfill (x1, y1, x2, y2, color)
Draws a box and fills it with color (assembler)
boxtitle (bp, position, col, title, fore, back)
Print a window title in the border
burble (1/pitch, duration)
Play≤ aε undescribablσ sounΣ iε thσ speaker« Yo⌡ havσ ì
to try various numbers to see the variety.
button ()
Returns joy stick button press status
circle (rc, cc, radius, aspect_num, aspect_den, color)
Draws graphics cicrle with aspect ratio
cls ()
Clear the screen and return mode and number of columns
è
cls_clr (fore, back)
Clear≤ tex⌠ screeε (8░ col)¼ set≤ attribute≤ anΣ place≤ ì
the cursor in the 'home' position
CM_INCH (cm)
Convert cm to inches
countch (*string, char)
Returns # of times a char occurs in a string
ct_bkclr (color)
Set background color
ct_char (row, col, fore, back, char)
Write a character directly to the video buffer
ctinit ()
Initializes video data for the windowing functions
ctone (freq, duration)
Sounds a tone of given frequency and duration
ct_peek (row, col)
Returns the WORD at row, col
ct_poke (row, col, char)
Pokes a WORD at row, col
ctposit (row, col)
Returns address of video memory byte at row, col
ct_sm (mode)
Set the video mode
ct_str (row, col, fore, back, *string)
Write a string directly to video buffer
ct_vstr (row, col, fore, back, *string)
Write a string vertically directly to video memory
ct_wstr (row, col, fore, back, *string, bp)
Write a string to video memory in a window
ct_wvstr (row, col, fore, back, *string, bp)
Write a vertical string to video memory in a window
DEG_RAD (degrees)
Convert degrees to radiansè
delay (millisecs)
Delay a number of ms, assumes 4.77 MHz clock
drawbox (bp)
Draws a predefined box on the screen
dwarn2 ()
Issue a warning & exit if not DOS 2.00 or greater
dwarn3 ()
Issue a warning & exit if not DOS 3.00 or greater
dx120bs ()
Backspace the DW printer 1/120th inch
dxback ()
Select backwards printing on the DW printer
dxbi ()
Select bidirectional printing
dxboldst ()
Begin bold print
dxbs ()
Send a backspace
dxbsend ()
End bold/shadow printing
dxchwide (number)
Set character width HMI (1/120ths inch)
dxclr1tab ()
Clear 1 tab
dxclrtab ()
Clear all tabs
dxcr ()
Send a carriage return
dxdefwid ()
Set DW printer to default HMI
dxeject ()
Eject paper
è
dxff ()
Send a form feed
dxfor ()
Select forward printing
dxhlf ()
Send a half line feed
dxht ()
Horizontal tab
dxinit ()
Initialize the DW printer
dxlf ()
Send a line feed
dxlinsp (number)
Set line spacing in (n-1)/48 inch
dxlmarg ()
Set left margin
dxpglen (length)
Set page length
dxrhlf ()
Send a reverse half line feed
dxrlf ()
Send a reverse line feed
dxsetht ()
Set a horizontal tab position
dxshast ()
Start shadow printing
dxundend ()
End underlined printing
dxundlst ()
Begin underlining
dxuni ()
Select unidirectional printing
è
endsound ()
Uninstal∞ thσ sounΣ time≥ interrup⌠ anΣ turε backgrounΣ ì
music off
equip ()
Returns a word indicating installed equipment
flagdec ()
Decrements mouse cursor flag by one
ì
forward (pixels)
Move the turtle forward a number of pixels
GAL_LT (gallons)
Convert gallons to liters
gcomtype ()
Returns a byte indicating the computer type in use
gcurpos (row, col, page)
Return current cursor position
getatch (page)
Returns char and attribute at current cursor position
getbcnt (which_button)
Returns the count of mouse button presses
getbrcnt (which_button)
Returns mouse button releases
getbstat ()
Returns current mouse button status
getchne ()
Return keyboard character with no echo
getctype (start, end, page)
Return the current cursor start & end lines and page
getcurp (&row, &col)
Return cursor position
getcurps (page, &row, &col)
Returns cursor position on a specified page
getdmaj ()
Return the DOS major version numberè
getdmin ()
Return the DOS minor version number
getdver ()
Return the DOS version number
gethpos ()
Returns the current mouse horizontal position
getkey ()
Destructive read of keyboard buffer
getkeycd ()
Return keycode - waits for key stroke
getmode ()
Returns the current video mode
getpage ()
Returns the current video page
getscode ()
Returns scan code for key stroke, waits for key
getstate ()
Get video state, mode, width, page into register struct
get_str ()
Get user string and replace CR with \0
getvpos ()
Returns the mouse current vertical position
gliss (start_freq, end_freq, rate)
sounds a glissando through the speaker
GM_OZ (grams)
Convert grams to ounces
gothic (char, row, col, color)
Writes a gothic character to the graphics screen
hollow (char, row, col, color)
Writes an outline character to the graphics screen
INCH_CM (inches)
Convert inches to cm
è
indexch (*string, char)
Return the first position of a character in a string
indexr (*string, char)
Return the rightmost position of char in string
iskey ()
Returns non-0 if key in buffer / 0 if no key
kbstat ()
Returns the keyboard status byte
keystat ()
DOS interrupt to return keyboard status byte
KG_LB (kilograms)
Convert kilograms to pounds
KM_MI (kilometers)
Convert kilometers to miles
LB_KG (pounds)
Convert pounds to kilograms
lhjoystk ()
Return the current horizontal pos, of left joystick
lightpen (&row, &col, &rasline, &ras_col)
Read the lightpen position
line (x1, y1, x2, y2, color)
Draw a graphics line
lprintf (*string)
Print a string to the line printer
lputch (char)
Send a character to the printer
lrotate (yc, xc, ys, xs, ye, xe, 3, angle)
Draw a rotated line around a center point
lsthpos (which_button)
Return last mouse horiz. position when button pressed
lsthrpos (which_button)
Last mouse horiz. position when button released
è
lstvpos (which_button)
Last mouse vertical pos. when button pressed
lstrvpos (which_button)
Last mouse vertical pos. when button release
LT_GAL (liters)
Conver liters to gallons
lvjoystk ()
Return the current vertical pos. of left joystick
M_YD (meters)
Convert meters to yards
makebdr (bp, type)
Sets a border type for a window/box
makebox (row, col, height, width, bfore, bback, ffore, fback)
Defines a new box/window and returns a pointer to it
memsize ()
Return memory size using int86 call
mgun ()
Makes a machine gun tye sound through the speaker
MI_KM (miles)
Convert miles to kilometers
moveto (row, col)
Move the turtle to an absolute position
mreset ()
Checks to see if mouse is installed
msize ()
Returns the number of K Bytes of memory installed
note (voice, octave, note, volume)
Set a musical note for TANDY 1000 voice
OZ_GM (ounces)
Convert ounces to grams
paint (row, col, color, border_color)
fill a bounded region with color
è
palette (a, b, c)
Change color set for graphics modes
a = palette (0-3)
b = 4 for normal colors / 5 for alternate color set
c = background color
pcurpos (row, col, page)
Places cursor to location
pencolor (color)
Defines turtle pen color
pendown ()
Places trutle pen on screen to draw
penup ()
Lifts turtle pen off screen
play (note, octave, time)
plays a foreground tone in the speaker
point (row, col, color)
Lights a single graphics pixel
prtbs ()
Send backspace to the graphics printer
prtbuzz ()
Sound the printer bell
prtcan ()
Cancel and clear the printer buffer
prtcomof ()
Turn off compressed print
prtcomon ()
Turn on compressed print mode
prtcr ()
Send a carriage return to the graphics printer
prtdubof ()
Turn off double print mode
prtdubon ()
Turn on double print mode
è
prtempof ()
Turn off emphasized print mode
prtempon ()
Turn on emphasized print mode
prtsec ()
Send an ESC code to the printer
prtff ()
Send a form feed to the graphics printer
prtlf ()
Send a line feed
prttab ()
Send atab to the graphics printer
prtwidof ()
Turn off the double width character mode
prtwidon ()
Turn on the double width character mode
RAD_DEG (radians)
Convert radians to degrees
rascha≥ (char¼ ULR¼ ULC¼ hmag¼ vmag¼ color)
Use≤ thσ interna∞ characte≥ fon⌠ description≤ t∩ ì
display characters at larger sizes
rdhcount ()
Reads current mouse horizontal motion counter
rdvcount ()
Reads current mouse vertical motion counter
readkey ()
Destructivσ returε oµ ASCI╔ anΣ scaε code≤ fo≥ ke∙ ì
rect (ULR, ULC, LRR, LRC, color)
Draw a filled rectangle
rect1 (ULR, ULC, LRR, LRC, bdr_clr, rect_clr)
Draw a flled rectangle bounded by a single pixel border
rect2 (ULR, ULC, LRR, LRC, bdr_clr, rect_clr)
Dra≈ ß flleΣ rectanglσ boundeΣ b∙ ß double pixe∞ borderè
redalert ()
Plays a red alert sound through the speaker
replacech (*string, old_char, new_char)
Replaces ALL occurences of char in string
resbox (bp)
Removes a window/box from the screen and restores video
rhjoystk ()
Return right joystick horizontal position
rotate (yc, xc, x, y, angle)
rotate a point around a given center point
rvjoystk ()
Return right joystick vertical position
savebox (bp)
Saves the memory where a window/box will be drawn
scankey ()
Returns scan and ASCII codes (non-destructive)
script (char, row, col, color)
Dra≈ ß simulateΣ handwritteε characte≥ oε thσ graphic≤ ì
screen
scrolldε (up_l_row¼ up_l_col¼ low_r_row¼ low_r_col¼ fore¼ back¼ ì
num_rows)
Scroll a bios window down
scrollup (up_l_row¼ up_l_col¼ low_r_row¼ low_r_col¼ fore¼ back¼ ì
num_rows)
Scroll a bios window up
setatten (voice, level)
Sets attenuation level on Tandy 1000 sound chip
setcallm (mask, address)
Define a mouse subroutine mask
setcur (h_hot, v_hot, cursor)
Define and pass a mouse graphics cursor
setcurp (row, col)
Sets the cursor to location
è
setcurps (page, row, col)
Sets position of cursor on the page
setcurt (start, end)
Sets the cursor type parameters
setcurtp (start, end)
Sets start and end lines for cursor
setfreq (voice, freq)
Set Tandy voice frequency
sethor (min, max)
Sets mouse min and max positions
setpage (page)
Set the current visual page number
set_pal (color_set)
Selects either color set 0 or 1 for graphics
setpal (0/1)
Selects a palette for graphics modes
setpos (hor, ver)
Set mouse cursor postion
setsound ()
enable≤ thσ backgrounΣ sounΣ interrup⌠ anΣ use≤ note≤ ì
iε arra∙ melod∙ anΣ timinτ iε arra∙ bea⌠ t∩ producσ ì
background sound
settxtc (type,screen_mask/first_line, cur_mask/lst_line)
Select and define mouse text cursor
setver (min, max)
Set max and min vertical mouse positions
sm (mode)
Set the video mode
smode (mode)
set video moe using int86
soundoff ()
Turn off Tandy sound chip
soundon ()
Turn on the Tandy sound chipè
spalreg (reg#, color)
Set the palette register values (Tandy & EGA only)
spratio (hor, ver)
Set mouse movement ratios
str_cent (*string, *destination, width)
Center a string within width
strclr (fore, back, *string)
C function to write a string in color
strdel (*string, start, number)
Delete a substring from a string
strpad (*string, number)
Add spaces to the left of a string
strtolow (*string)
Convert a string to all lower case
strtoup (*string)
Convert a string to all upper case
tcos (angle)
returε ▓ digi⌠ valuσ oµ cosinσ fo≥ wholσ degree≤ - ì
operates faster for graphics plotting
tone (freq, time_in_ms)
play a tone - time assumes 4.77 MHz clock
tsin (angle)
returε ▓ digi⌠ valuσ oµ siε fo≥ wholσ degree≤ - ì
operates faster for graphics than does the sin function
turnleft (angle)
Turns the turtle heading left
turnright (angle)
Turns the turtle heading right
usrfont (char, ULR, ULC, hmag, vmag, color, font#)
Allow≤ use≥ t∩ selec⌠ froφ predetermineΣ font≤ thσ ì
style of character to display
vbar3d (base, height, col, width, depth, color, outline_color)
3d bar graph plot function
è
wac (char, color/attribute, xor_flag)
Write a character and attribute/color using BIOS call
waitkey ()
Pauses and waits for key stroke if none in buffer
watch (page, num_chars, char, fore, back)
Writes character(s) in color using BIOS call
wch (page, num_chars, char, color)
Write≤ char(s⌐ t∩ pagσ (tex⌠ mode⌐ iε colo≥ (graphic≤ ì
mode)
wchtty (char, fore)
Write≤ characte≥ usinτ tt∙ BIO╙ mode¼ colo≥ iµ graphic≤ ì
mode in use
wco (char, color)
Writσ characte≥ onl∙ (colo≥ i≤ activσ iε graphics¼ ì
dummy parameter in text modes)
wgets (bp, row, col, len)
Return a string that exists inside a window
w_hline (row, col,fore, back, char, width)
Draw a horizontal line of character
wnoise (low_freq, high_freq, duration)
Produces white noise over a specified freq range
wputs (bp, str, row, col)
Puts s string to a window using BIOS
wtty (char, color)
Writσ characte≥ iε TT┘ mode¼ colo≥ i≤ onl∙ activσ iε ì
graphics modes, in text modes it is a dummy parameter
w_hline (row, col, fore, back, ch, width)
Draw a horizontal line of character
w_vline (row, col, fore, back, char, height)
Draws a vertical string of character
YD_M (yards)
Convert yards to meters
.paè
Appendix A
Thi≤ sectioε oµ thσ manua∞ i≤ ß detaileΣ descriptioε oµ thσ ì
functions« I⌠ include≤ ß descriptioε oµ thσ function¼ ß samplσ ì
cal∞ froφ C¼ ß samplσ prograφ o≥ prograφ fragmen⌠ usinτ thσ ì
functioε anΣ an∙ return≤ froφ thσ function« IncludeΣ als∩ arσ ì
an∙ limits¼ peculiaritie≤ o≥ othe≥ informatioε abou⌠ thσ ì
function≤ requireΣ fo≥ effectivσ usσ iε programming.
.paè.he _C_Tool_Box___________________________________________Appendix_A_
atsay
Thi≤ functioε i≤ simila≥ t∩ thσ dBAS┼ functioε oµ thσ samσ namσ ì
iε tha⌠ i⌠ allow≤ thσ use≥ t∩ print¼ iε color¼ ß strinτ a⌠ ß ì
specified location on the screen.
Call:
atsay(row, col, fore, back, *string)
row = the starting row for the string
col = the starting column for the string
fore = the foreground color of the string
back = the background color of the string
string = the string to be printed on the screen
Example:
main()
{
/* sm(4); */
atsay(5, 10, 3, 2, "Testing");
}
Thi≤ prograφ wil∞ prin⌠ thσ strinτ "Testingó oε thσ ì
screeε iε colo≥ 3¼ startinτ a⌠ ro≈ ╡ columε 10« Iµ iε ì
graphic≤ modσ (removσ thσ comments⌐ thσ backgrounΣ ì
colo≥ wil∞ bσ colo≥ 2¼ fo≥ tex⌠ modσ thi≤ paramete≥ i≤ ì
a dummy parameter.
Return:
None
Caveats:
BackgrounΣ colo≥ i≤ onl∙ activσ iε graphic≤ modes« Fo≥ ì
tex⌠ mode≤ i⌠ i≤ ß dumm∙ parameter« Fo≥ writtinτ witΦ ì
ß backgrounΣ colo≥ iε tex⌠ mode≤ usσ thσ watcΦ ì
function.
Bσ surσ thσ strinτ parameter≤ liσ withiε thσ screeε ì
boundries.
.paè
This ends the Board version of the manual.
Thσ ful∞ manua∞ wil∞ bσ sen⌠ witΦ al∞ librar∙ sourcσ codσ t∩ al∞ ì
registereΣ owner≤ oµ thσ ├ Too∞ bo° Library« Therσ simpl∙ i≤ no⌠ ì
enough room in a bulletin board sized file.
Thi≤ sectioε oµ thσ manua∞ i≤ aε earl∙ version« Thσ fina∞ manua∞ ì
wil∞ contaiε completσ description≤ oµ al∞ aspect≤ oµ thσ too∞ ì
Box« I⌠ i≤ availablσ iε tw∩ disδ formats« Onσ suitablσ fo≥ ì
printinτ froφ DO╙ anΣ onσ iε WordSta≥ format« I⌠ i≤ als∩ ì
availablσ iε thσ forφ oµ preprinteΣ page≤ suitablσ fo≥ ß threσ ì
ring binder.
Thσá followinτ i≤ includeΣ sincσ thσ ful∞ manua∞ i≤ no⌠ witΦ thi≤ ì
file.
BACKGROUND SOUND FUNCTIONS INFORMATION
Thσ number≤ fo≥ thσ musica∞ note≤ arσ listeΣ belo≈ fo≥ thσ octavσ ì
starting with middle C:
C C# D D# E F F# G G# A A# B
24 25 26 27 28 29 30 31 32 33 34 35
The note 100 may be used for rests.
Timing for the notes is in timer ticks (18.2 per second).
See the full manual for further details.
Placσ thσ note≤ iε aε arra∙ calleΣ melody[▌ anΣ thσ timinτ coun⌠ ì
iε aε arra∙ calleΣ beat[]¼ seσ ctdemo.π fo≥ aε example« Othe≥ ì
song≤ ma∙ bσ defineΣ witΦ note≤ anΣ timinτ iε differen⌠ array≤ ì
bu⌠ thesσ wil∞ havσ t∩ bσ copieΣ int∩ thσ melod∙ anΣ bea⌠ array≤ ì
beforσ activatioε thσ backgrounΣ sounΣ function« ┴ futurσ ì
release will pass a pointer to the desired array.